// import {
// 	dataCity
// }
// from "./data.js"
// 整点时间戳的获取
export function getTimestampAt11AM(val) {
	const now = new Date();
	// 设置当日的11点
	now.setHours(val);
	now.setMinutes(0); // 分
	now.setSeconds(0); // 秒
	now.setMilliseconds(0); // 毫秒

	// 获取11点的时间戳
	return now.getTime();
}


// 整理时间格式化
function formatDate(date, type) {
	var myyear = date.getFullYear();
	var mymonth = date.getMonth() + 1;
	var myweekday = date.getDate();

	var hours = date.getHours();
	var minutes = date.getMinutes();

	if (mymonth < 10) {
		mymonth = "0" + mymonth;
	}
	if (myweekday < 10) {
		myweekday = "0" + myweekday;
	}

	if (hours < 10) {
		hours = "0" + hours;
	}

	if (minutes < 10) {
		minutes = "0" + minutes;
	}

	if (type == 1) {
		return (myyear + mymonth + myweekday);
	} else {
		return (myyear + mymonth + myweekday + hours + minutes);
	}

}

//获得某月的天数
function getMonthDays(myMonth) {
	var monthStartDate = new Date(nowYear, myMonth, 1);
	var monthEndDate = new Date(nowYear, myMonth + 1, 1);
	var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24);
	return days;
}


var now = new Date(); //当前日期
var nowDayOfWeek = now.getDay(); //今天本周的第几天
var nowDay = now.getDate(); //当前日
var nowMonth = now.getMonth(); //当前月
var nowYear = now.getYear(); //当前年
const nowHours = now.getHours();
const nowMinutes = now.getMinutes();
nowYear += (nowYear < 2000) ? 1900 : 0; //

//今天
var getCurrentDate = new Date(nowYear, nowMonth, nowDay, nowHours, nowMinutes);
// 今天开始时间
export var getCurrentStartDate = formatDate(getCurrentDate, 1) + '0000'
// 今天结束时间
export var getCurrentEndDate = formatDate(getCurrentDate, 2)

//昨天
var getYesterdayDate = new Date(nowYear, nowMonth, nowDay - 1);
var getYesterdayEndDate = new Date(nowYear, nowMonth, nowDay);
export var getYesterdayStartDate = formatDate(getYesterdayDate, 1) + '0000';
export var getYesterdayEndAllDate = formatDate(getYesterdayEndDate, 1) + '0000';

//获得本周的开始日期
var getWeekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
export var getWeekStartDate = formatDate(getWeekStartDate, 1) + '0000';
//获得本周的结束日期
var getWeekEndDate = new Date(nowYear, nowMonth, nowDay, nowHours, nowMinutes);
export var getWeekEndDate = formatDate(getWeekEndDate, 2);

//获得本月的开始日期
var getMonthStartDate = new Date(nowYear, nowMonth, 1);
export var getMonthStartDate = formatDate(getMonthStartDate);

//获得本月的结束日期
var getMonthEndDate = new Date(nowYear, nowMonth, nowDay, nowHours, nowMinutes);
export var getMonthEndDate = formatDate(getMonthEndDate, 2);